import { getCategoryList } from '@/services/category.js';

// eslint-disable-next-line import/no-anonymous-default-export
export default {
  namespace: 'category',
  state: {
    list: []
  },
  reducers: {
    setState(state, { payload }) {
      // console.log(payload);
      return {
        ...state,
        list: payload.data
      }
    }
  },
  effects: {
    *getCategoryListDetail({ payload }, { call, put }) {
      const list = yield call(getCategoryList);
      console.log(list);
      yield put({
        type: 'setState',
        payload: list
      });
    }
  },
}